package com.koron.plan.web.repairplan.service;

import com.koron.bean.workflow.RedirectQuery;
import com.koron.plan.web.maintainplan.bean.vo.MaintainPlanDetailVO;
import com.koron.plan.web.repairplan.bean.entity.PlanPackageIssueBean;
import com.koron.plan.web.repairplan.bean.query.PlanPackageIssueQuery;
import com.koron.plan.web.repairplan.bean.vo.PlanPackageIssueVO;
import org.koron.ebs.mybatis.SessionFactory;

import java.util.List;

/**
 * @author twcao
 * @title: PlanPackageIssueService
 * @projectName GDH_EAM_V2
 * @description: 保存工单计划service
 * @date 2021/9/1314:10
 */
public interface PlanPackageIssueService {

    PlanPackageIssueVO queryById(SessionFactory factory, String id);

    /**
     * 保存或更新
     * @param factory 会话
     * @param beans 实例
     * @return
     */
    boolean saveOrUpdate(SessionFactory factory, List<PlanPackageIssueBean> beans);

    /**
     * 保存或更新
     * @param factory
     * @param vo
     * @return
     */
    PlanPackageIssueVO saveOrUpdate(SessionFactory factory, PlanPackageIssueVO vo);

    /**
     * 根据计划包id删除工单计划
     * @param packageId 计划包id
     * @return
     */
    boolean deleteByPackageId(SessionFactory factory, String packageId);

    /**
     * 根据计划id删除
     * @param factory
     * @param issueId
     * @return
     */
    boolean deleteById(SessionFactory factory, String issueId);

    /**
     * 通过实体作为筛选条件查询
     * @param query 实例对象
     * @return 对象列表
     */
    List<PlanPackageIssueVO> queryList(SessionFactory factory, PlanPackageIssueQuery query);

    /**
     * 下发计划
     * @param factory 会话
     * @param issueId 计划id
     * @return
     */
    PlanPackageIssueBean issued(SessionFactory factory, String issueId);

    /**
     * 执行工单后，调用此接口
     * @param factory 会话
     * @param issueCode 工单编号
     * @param issueState 工单状态
     * @return
     */
    PlanPackageIssueBean issueStateChange(SessionFactory factory, String issueCode, Integer issueState);

    /**
     * 工作流更新
     * @param factory
     * @param redirectQuery
     */
    Boolean workflowUpdate(SessionFactory factory, RedirectQuery redirectQuery);

    /**
     * 新增或更新
     * @param factory 会话
     * @param detailVO 保存的实体
     * @return 保存成功后的实体
     */
    MaintainPlanDetailVO saveOrUpdateExperiment(SessionFactory factory, MaintainPlanDetailVO detailVO);

    /**
     * 下发巡视计划，生成工单
     * @param factory 会话
     * @param id 维保计划id
     * @return
     */
    MaintainPlanDetailVO issue(SessionFactory factory, String id);

}
